package com.ffmpeg.util.infra.util;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author :wm
 * @description :ProcessBuilder工具类
 */
@Component
public class ProcessBuilderUtils {
    private final static Logger logger = LoggerFactory.getLogger(ProcessBuilderUtils.class);

    public ProcessBuilder generatorProcessBuilder(String command) {
        if (StringUtils.isEmpty(command)) {
            logger.error("command is empty");
            return null;
        }
        String[] args = StringUtils.split(command, StringUtils.SPACE);
        return new ProcessBuilder(args);
    }
}
